﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BPM.Web;
using BPM.Web;
using BPM.Service;

namespace BPM.Controllers
{
	public class MaterialDeliveryController : InternalViewController
	{
		/// <summary>
		/// 物料出库
		/// </summary>
		/// <returns></returns>
		public ActionResult MaterialDelivery()
		{
			return View();
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="allMaterials">
		/// id=amount,id=amount,id=amount...
		/// </param>
		/// <param name="purchaseOrderId"></param>
		/// <returns></returns>
		public ActionResult AJAX_SubmitMaterials(
			string allMaterials
			)
		{
			var materialsAmount = MaterialInDeliveryController.ReadAllMaterials(allMaterials);

			var res = new MaterialInDeliveryService().MaterialOut(materialsAmount, this.CurrentUser);

			return Json(res);
		}

		/// <summary>
		/// 等待审核的物料出库请求列表
		/// </summary>
		/// <returns></returns>
		public ActionResult PendingMaterialDeliveryList()
		{
			return View();
		}

		/// <summary>
		/// 等待审核的物料出库请求
		/// </summary>
		/// <returns></returns>
		public ActionResult PendingMaterialDelivery()
		{
			return View();
		}
	}

	public class MaterialDeliveryControllerActions : ControllerDefinition<MaterialDeliveryController>
	{
		public readonly string MaterialDelivery = "MaterialDelivery";
		public readonly string PendingMaterialDeliveryList = "PendingMaterialDeliveryList";
		public readonly string PendingMaterialDelivery = "PendingMaterialDelivery";
	}
}
